/**
 * GraphicalGame is used to create a general window for a player to choose the
 * desired game
 */
package mainClasses;

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.File;
import java.io.IOException;

import javax.swing.*;



public class GraphicalGame extends JFrame implements ActionListener, MouseListener{

	Dimension dimension = new Dimension(500, 550);

	
	BoardGame newGame;
	JPanel gamePanel;
	JPanel mainMenuPanel;
	JMenuBar gameMenuBar;
	InputAndOutput io;

	JLabel mainLabel;
	JButton knightsTour;
	JButton chess;
	JButton eightQueens;
	
	
	JLabel InformationLabel;
	JButton help;
	JButton chessHelp;
	JButton queenHelp;
	JButton knightHelp;
	
	int helpCounter = 0;
	
	Boolean gameChosen;
	
	JMenu menu_file;
	JMenu menu_edit;
	JMenu menu_help;
	JMenuItem about;
	JMenuItem exit;
	JMenuItem restart;
	JMenuItem mainMenu;
	JMenuItem save;
	JMenuItem load;
	JMenuItem undo;
	JMenuItem redo;
	JMenuItem instructions;
	HelpAndAbout frame;
	/**
	 * Constructor for GraphicalGame. It sets the properties of the JFrame and creates the components that 
	 * prompts the user to chose the game to be player by clicking on one of three buttons ("chess", "Knight's Tour" 
	 * or "Eight Queens".  
	 */
	public GraphicalGame(){
		this.setTitle("Game: The Eight Queens, The Knight's Tour, Chess Game");		//set the title of the window
		this.setSize(this.dimension);								//set the board size/dimension
		this.setResizable(false);									//disables the ability to resize the window
		
		this.setLayout(new BorderLayout());	
		/*
		 * Initialize the board panel (gamePanel), the menu bar (gameMenuBar) and the input output panel (io) so 
		 * they could be used once the game has been chosen
		 */	
		
		gamePanel = new JPanel();
		gameMenuBar = new JMenuBar();
		io = new InputAndOutput();
		
		gamePanel.addMouseListener(this);

		/*
		 * Create and add the three buttons and the main label to the gamePanel
		 */
		mainLabel = new JLabel("Please choose the game you would like to play:", (int) CENTER_ALIGNMENT);
		mainLabel.setFont(new Font("Time New Roman", Font.BOLD, 20));
		mainLabel.addMouseListener(this);
		
		
		knightsTour = new JButton();
		knightsTour.setIcon(new ImageIcon("knight-tour-button.png"));
		knightsTour.addMouseListener(this);
		
		chess = new JButton();
		chess.setIcon(new ImageIcon("chess-button.png"));
		chess.addMouseListener(this);
		
		eightQueens = new JButton();
		eightQueens.setIcon(new ImageIcon("Eight-Queen-button.png"));
		eightQueens.addMouseListener(this);
		
		help = new JButton();
		help.addActionListener(this);
		help.setIcon(new ImageIcon("Help.png"));
		help.addMouseListener(this);
		
		chessHelp = new JButton();
		chessHelp.addActionListener(this);
		chessHelp.setIcon(new ImageIcon("Chess-info.png"));
		chessHelp.addMouseListener(this);
		
		queenHelp = new JButton();
		queenHelp.addActionListener(this);
		queenHelp.setIcon(new ImageIcon("Eight-queen-info.png"));
		queenHelp.addMouseListener(this);
		
		
		knightHelp = new JButton();
		knightHelp.addActionListener(this);
		knightHelp.setIcon(new ImageIcon("Knight-tour-info.png"));
		knightHelp.addMouseListener(this);
		
		/*
		 * 
		 * Adds 'this' instance of GraphicalGame (also a JFrame) to the listeners of the three game buttons 
		 * so when the player choses the game he/she wishes to play, 'this' would create an instance of 
		 * the appropriate game
		 */
		knightsTour.addActionListener(this);
		chess.addActionListener(this);
		eightQueens.addActionListener(this);
		
		this.InformationLabel = new JLabel();
		this.InformationLabel.setOpaque(true);
		this.InformationLabel.setOpaque(true);
		this.InformationLabel.setFont(new Font("Time New Roman", Font.ITALIC, 15));
		this.InformationLabel.setBackground(Color.black);
		this.InformationLabel.setHorizontalAlignment(JTextField.CENTER);
		
		
		/*
		 * Adds the mainLabel and the three buttons to the gamePanel and sets the gamePanel's
		 *  visibility to true
		 */
		gamePanel.setLayout(new GridLayout(8, 1));

		gamePanel.add(mainLabel);
		gamePanel.add(chess);
		gamePanel.add(knightsTour);
		gamePanel.add(eightQueens);
		gamePanel.add(help);

		gamePanel.setVisible(true);

		this.io.setMode(3);
		
		/*
		 * Adds the gamePanel, io and menuBar to 'this' (frame or window)
		 */
		this.add(gamePanel, "Center");
		this.add(io, "South");
		this.add(this.InformationLabel, "North");
		this.setJMenuBar(gameMenuBar);
				
		menu_file = new JMenu("File");
		menu_edit = new JMenu("Edit");
		menu_help = new JMenu("Help");
		about = new JMenuItem("About");
		exit = new JMenuItem("Exit");
		restart = new JMenuItem("Restart");
		undo = new JMenuItem("Undo");
		redo = new JMenuItem("Redo");
		mainMenu = new JMenuItem("Main Menu");
		instructions = new JMenuItem("Instructions");
		save = new JMenuItem("Save");
		load = new JMenuItem("Load");
		mainMenu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, InputEvent.CTRL_MASK));
		restart.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0));
		exit.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0));
		undo.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_MASK));
		redo.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Y, InputEvent.CTRL_MASK));
		instructions.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_H, InputEvent.CTRL_MASK));
		save.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK));
		load.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_L, InputEvent.CTRL_MASK));
		menu_file.add(save);
		menu_file.add(load);
		menu_file.add(restart);
		menu_file.add(mainMenu);
		menu_file.add(exit);
		menu_edit.add(undo);
		menu_edit.add(redo);
		menu_help.add(instructions);
		menu_help.add(about);
		this.about.addActionListener(this);
		this.save.addActionListener(this);
		this.load.addActionListener(this);
		this.restart.addActionListener(this);
		this.mainMenu.addActionListener(this);
		this.exit.addActionListener(this);
		this.undo.addActionListener(this);
		this.redo.addActionListener(this);
		this.instructions.addActionListener(this);

		
		gameMenuBar.add(menu_file);
		gameMenuBar.add(menu_edit);
		gameMenuBar.add(menu_help);

		
		this.setDefaultCloseOperation(GraphicalGame.EXIT_ON_CLOSE);
		
		this.InformationLabel.setText("<html><font color=white> " + "Welcome to <font color=red> MAIN MENU </font>" + " </font></html>");
		
		
		gameChosen = false;
		this.setVisible(true);			//Sets the frame's visibility to true
	}
	
	/**
	 * main(). The static method creates a new instance of the GraphicalGame
	 * @param args
	 */
	public static void main(String args[])
	{
		GraphicalGame game = new GraphicalGame();
		game.setVisible(true);
	}

	
	
	
	
	
	

	/**
	 * The method is invoked when an event occurs and receives an ActionEvent that contains all the 
	 * information of the event. Depending on the source of the event (or the Object that created that event), this
	 * method acts appropriately 
	 * @param e ActionEvent that contains the information of the event that occured.
	 */
	public void actionPerformed(ActionEvent e) {
		if(e.getSource() ==this.instructions)
		{
			frame = new HelpAndAbout();
			frame.setLocation((int)this.getLocation().getX(), (int)this.getLocation().getY());
			frame.setSize(this.getSize());
			frame.setResizable(false);
			frame.setLayout(new GridLayout(1,1));
			
			if(this.gamePanel instanceof GraphicalChess){
				frame.setHelpIcon(HelpAndAbout.CHESS);
				frame.setVisible(true);
			}else if(this.gamePanel instanceof GraphicalKnightsTour){
				frame.setHelpIcon(HelpAndAbout.KNIGHT);
				frame.setVisible(true);
			}else if(this.gamePanel instanceof GraphicalEightQueens){
				frame.setHelpIcon(HelpAndAbout.QUEEN);
				frame.setVisible(true);
			}else
			{
				this.setSize(500, 550);
				this.io.setMode(3);
				if(helpCounter==0)
				{
					gamePanel.add(this.chessHelp);
					gamePanel.add(this.knightHelp);
					gamePanel.add(this.queenHelp);
					this.helpCounter++;
					gamePanel.revalidate();
					gamePanel.repaint();
					this.setVisible(true);
				}else
				{
					closeExtraHelp();
					
				}
			}
		}
		if(e.getSource() == this.about)
		{
			int width = (int) this.getSize().getWidth();
			frame = new HelpAndAbout();
			frame.setLocation((int)this.getLocation().getX(), (int)this.getLocation().getY());
			frame.setSize(668, 853);
			frame.setLocation(new Point(((int)this.getLocation().getX()) + width, ((int)this.getLocation().getY())));
			frame.setResizable(false);
			frame.setLayout(new GridLayout(1,1));
			frame.setHelpIcon(HelpAndAbout.US);
			frame.setVisible(true);
			if(this.gamePanel instanceof GraphicalChess){
				frame.setSize(this.getSize());
				frame.setLocation(this.getLocation());
				frame.setHelpIcon(HelpAndAbout.US);
				frame.setVisible(true);
			}else if(this.gamePanel instanceof GraphicalKnightsTour){
				frame.setSize(this.getSize());
				frame.setLocation(this.getLocation());
				frame.setHelpIcon(HelpAndAbout.US);
				frame.setVisible(true);
			}else if(this.gamePanel instanceof GraphicalEightQueens){
				frame.setSize(this.getSize());
				frame.setLocation(this.getLocation());
				frame.setHelpIcon(HelpAndAbout.US);
				frame.setVisible(true);
			}
		}
		if(e.getSource()==this.save)
		{
			if(this.gamePanel instanceof GraphicalChess){
				try {
					((GraphicalChess) gamePanel).save();
				} catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}else if(this.gamePanel instanceof GraphicalKnightsTour){
				try {
					((GraphicalKnightsTour) gamePanel).save();
				} catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}else if(this.gamePanel instanceof GraphicalEightQueens){
				try {
					((GraphicalEightQueens) gamePanel).save();
				} catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
			}
		}
		if(e.getSource()==this.load)
		{
			if(this.gamePanel instanceof GraphicalChess){
				((GraphicalChess) gamePanel).load();
			}else if(this.gamePanel instanceof GraphicalKnightsTour){
				((GraphicalKnightsTour) gamePanel).load();
			}else if(this.gamePanel instanceof GraphicalEightQueens){
				((GraphicalEightQueens) gamePanel).load();
			}else
			{
				Object[] possibilities = {"Chess Game", "Knight Tour Game", "Eight Queen"};
	    		String fileName = (String)JOptionPane.showInputDialog(this, "Select the game to be loaded :", "Customized Dialog", JOptionPane.PLAIN_MESSAGE, null,possibilities, "ham");
	    		this.remove(gamePanel);
				if(fileName.equals("Chess Game"))
				{
					this.setSize(650, 750);
					this.setTitle("Chess Game");
					this.gamePanel = new GraphicalChess(io);
					this.io.setCurrentGame((BoardGame) gamePanel);
					this.InformationLabel.setText("<html><font color=white> " + "WELCOME TO CHESS GAME" + " </font></html>");
					this.gameChosen = true;
				}
				else if(fileName.equals("Knight Tour Game"))
				{
					this.setSize(650, 700);
					this.setTitle("Knight Tour Game");
					this.gamePanel = new GraphicalKnightsTour(io);
					this.io.setCurrentGame((BoardGame) gamePanel);
					this.InformationLabel.setText("<html><font color=white> " + "WELCOME TO THE KNIGHT'S TOUR" + " </font></html>");
					this.gameChosen = true;
				}
				else if(fileName.equals("Eight Queen"))
				{
					this.setSize(650, 700);
					this.setTitle("Eight Queen Game");
					this.gamePanel = new GraphicalEightQueens(io);
					this.io.setCurrentGame((BoardGame) gamePanel);
					this.InformationLabel.setText("<html><font color=white> " + "WELCOME TO THE EIGHT QUEENS" + " </font></html>");
					this.gameChosen = true;
				}
				this.add(gamePanel, "Center");
				this.setVisible(true);
				if(this.gamePanel instanceof GraphicalChess){
					((GraphicalChess) gamePanel).load();
				}else if(this.gamePanel instanceof GraphicalKnightsTour){
					((GraphicalKnightsTour) gamePanel).load();
				}else if(this.gamePanel instanceof GraphicalEightQueens){
					((GraphicalEightQueens) gamePanel).load();
				}
			}
		}
		if(e.getSource() ==this.undo)
		{
			if(this.gamePanel instanceof GraphicalChess){
				((GraphicalChess) gamePanel).undo();
			}else if(this.gamePanel instanceof GraphicalKnightsTour){
				((GraphicalKnightsTour) gamePanel).undo();
			}else if(this.gamePanel instanceof GraphicalEightQueens){
				((GraphicalEightQueens) gamePanel).undo();
			}
		}else if(e.getSource() ==this.redo)
		{
			if(this.gamePanel instanceof GraphicalChess){
				((GraphicalChess) gamePanel).redo();
			}else if(this.gamePanel instanceof GraphicalKnightsTour){
				((GraphicalKnightsTour) gamePanel).redo();
			}else if(this.gamePanel instanceof GraphicalEightQueens){
				((GraphicalEightQueens) gamePanel).redo();
			}
		}
		if(e.getSource() ==this.exit){
			int n = 10;
			if(this.gamePanel instanceof GraphicalChess || this.gamePanel instanceof GraphicalKnightsTour || this.gamePanel instanceof GraphicalEightQueens)
			{
				n = JOptionPane.showConfirmDialog(this, "Would you like to save before closing the game?", "Save? Question", JOptionPane.YES_NO_OPTION);
			}
			if(n==0)
			{
				if(this.gamePanel instanceof GraphicalChess){
					try {
						((GraphicalChess) gamePanel).save();
					} catch (IOException e1) {
						// TODO Auto-generated catch block
						e1.printStackTrace();
					}
				}else if(this.gamePanel instanceof GraphicalKnightsTour){
					try {
						((GraphicalKnightsTour) gamePanel).save();
					} catch (IOException e1) {
						// TODO Auto-generated catch block
						e1.printStackTrace();
					}
				}else if(this.gamePanel instanceof GraphicalEightQueens){
					try {
						((GraphicalEightQueens) gamePanel).save();
					} catch (IOException e1) {
						// TODO Auto-generated catch block
						e1.printStackTrace();
					}
				}
				System.exit(0);
			}else
			{
				System.exit(0);
			}
			
		}
		else if(e.getSource() ==this.restart){
			if(this.gamePanel instanceof GraphicalChess){
				this.setSize(650, 750);
				((GraphicalChess) gamePanel).restart();
			}
			
			else if(this.gamePanel instanceof GraphicalKnightsTour){
				this.setSize(650, 700);
				((GraphicalKnightsTour) gamePanel).restart();
			}
			
			else if(this.gamePanel instanceof GraphicalEightQueens){
				this.setSize(650, 700);
				((GraphicalEightQueens) gamePanel).restart();
			}
			
		}else if(e.getSource()==this.chessHelp)
		{
			this.setSize(500, 700);
			this.io.clearHelpInfor();
			this.io.setMode(5);
			this.io.HelpInfor("Step 1: Players will enter their names at the bottom of the window.");
			this.io.HelpInfor("Step 2: The game will start with Player 1.");
			this.io.HelpInfor("Step 3: Player will choose the piece to move.");
			this.io.HelpInfor("Step 4: The game will provide the possible moveable locations by");
			this.io.HelpInfor("             highlighting the blocks with yellow color.");
			this.io.HelpInfor("Step 5: Player choose the location by clicking on it.");
			this.io.HelpInfor("Step 6: When moving king the player have to move it to a secured area.");
			this.io.HelpInfor("Step 7: When pawn promoted player have to enter the name of the");
			this.io.HelpInfor("             piece he/she wanted.");
			this.io.HelpInfor("Step 8: The game ends in win/lost when checkmate.");
			this.io.HelpInfor("Step 9: The game end in draw when stalemate.");
			closeExtraHelp();
		}else if(e.getSource()==this.queenHelp)
		{
			this.setSize(500, 700);
			this.io.clearHelpInfor();
			this.io.setMode(5);
			this.io.HelpInfor("Step 1: The game will ask the player to place the first Queen");
			this.io.HelpInfor("             on the board.");
			this.io.HelpInfor("Step 2: Right after the first Queen has been placed, red-colored");
			this.io.HelpInfor("             squares will appear.");
			this.io.HelpInfor("Step 3: The following 7 Queens cannot be placed on the red squares.");
			this.io.HelpInfor("Step 4: When the next Queen have been placed, more red squares");
			this.io.HelpInfor("             will appear and less available squares for next Queens.");
			this.io.HelpInfor("Step 5: The player wins if all 8 Queens managed to be placed on the");
			this.io.HelpInfor("             board without threatening each other.");
			this.io.HelpInfor("Step 6: The player loses if there's no more available square for");
			this.io.HelpInfor("             next Queen.");
			this.io.HelpInfor("Step 7: The player can choose to restart the game or exit the application.");
			closeExtraHelp();
		}else if(e.getSource()==this.knightHelp)
		{
			this.setSize(500, 700);
			this.io.clearHelpInfor();
			this.io.setMode(5);
			this.io.HelpInfor("Step 1: The game will ask the player to move the Knight at");
			this.io.HelpInfor("             the upper-left corner of the board.");
			this.io.HelpInfor("Step 2: The Knight has to move according to the original chess");
			this.io.HelpInfor("             game rule.");
			this.io.HelpInfor("Step 3: The Knight must visit each square on the board once and");
			this.io.HelpInfor("             because this is an open Knight's Tour, the Knight don't have ");
			this.io.HelpInfor("             to return to the initial square.");
			this.io.HelpInfor("Step 4: The squares that have been visited will be colored in red.");
			this.io.HelpInfor("Step 5: The player wins if all squares were visited once by the Knight.");
			this.io.HelpInfor("Step 6: If the player is trapped (the Knight have no possible squares");
			this.io.HelpInfor("             to move), the game can be restarted.");
			closeExtraHelp();
		}
		
		else if(e.getSource() ==this.mainMenu){
			this.newGame();
		}
		
		
		else if(e.getSource()==this.help)
		{
			this.setSize(500, 550);
			this.io.setMode(3);
			if(helpCounter==0)
			{
				gamePanel.add(this.chessHelp);
				gamePanel.add(this.knightHelp);
				gamePanel.add(this.queenHelp);
				this.helpCounter++;
				gamePanel.revalidate();
				gamePanel.repaint();
				this.setVisible(true);
			}else
			{
				closeExtraHelp();
				
			}
		}
		
		
		
		else if(!gameChosen)
		{
			this.remove(gamePanel);
			
			if(e.getSource() == chess)
			{
				this.setSize(650, 750);
				this.setTitle("Chess Game");
				this.gamePanel = new GraphicalChess(io);
				this.io.setCurrentGame((BoardGame) gamePanel);
				this.InformationLabel.setText("<html><font color=white> " + "WELCOME TO CHESS GAME" + " </font></html>");
				this.gameChosen = true;
			}
			else if(e.getSource() == knightsTour)
			{
				this.setSize(650, 700);
				this.setTitle("Knight Tour Game");
				this.gamePanel = new GraphicalKnightsTour(io);
				this.io.setCurrentGame((BoardGame) gamePanel);
				this.InformationLabel.setText("<html><font color=white> " + "WELCOME TO THE KNIGHT'S TOUR" + " </font></html>");
				this.gameChosen = true;
			}
			else if(e.getSource() == eightQueens)
			{
				this.setSize(650, 700);
				this.setTitle("Eight Queen Game");
				this.gamePanel = new GraphicalEightQueens(io);
				this.io.setCurrentGame((BoardGame) gamePanel);
				this.InformationLabel.setText("<html><font color=white> " + "WELCOME TO THE EIGHT QUEENS" + " </font></html>");
				this.gameChosen = true;
			}
			this.add(gamePanel, "Center");
			this.setVisible(true);

		}else{}
	}

	private void closeExtraHelp() {
		this.InformationLabel.setText("<html><font color=white> " + "Welcome to <font color=red> MAIN MENU </font>" + " </font></html>");
		gamePanel.removeAll();
		gamePanel.add(mainLabel);
		gamePanel.add(chess);
		gamePanel.add(knightsTour);
		gamePanel.add(eightQueens);
		gamePanel.add(help);
		gamePanel.revalidate();
		gamePanel.repaint();
		gamePanel.setVisible(true);
		this.setVisible(true);
		this.helpCounter = 0;
	}
	
	
	public void newGame()
	{
		this.gamePanel.removeAll();
		JFrame frame = new GraphicalGame();
		frame.setLocation(this.getLocation());
		this.dispose();
		
	}



	
	
	
	
	@Override
	public void mouseClicked(MouseEvent e) {
		// TODO Auto-generated method stub
		
	}



	@Override
	public void mouseEntered(MouseEvent e) {
		if(e.getSource()==this.chess)
		{
			this.chess.setIcon(new ImageIcon("chess-button4.png"));
			this.InformationLabel.setText("<html><font color=white> " + "Click Here to play <font color=red> CHESS GAME </font>" + " </font></html>");
		}else if(e.getSource()==this.eightQueens)
		{
			this.eightQueens.setIcon(new ImageIcon("Eight-Queen4-button.png"));
			this.InformationLabel.setText("<html><font color=white> " + "Click Here to play <font color=red> THE EIGHT QUEENS GAME </font>" + " </font></html>");

		}else if(e.getSource()==this.knightsTour)
		{
			this.knightsTour.setIcon(new ImageIcon("knight-tour4-button.png"));
			this.InformationLabel.setText("<html><font color=white> " + "Click Here to play <font color=red> THE KNIGHT'S TOUR GAME </font>" + " </font></html>");

		}else if(e.getSource()==this.help)
		{
			this.help.setIcon(new ImageIcon("Help4.png"));
			if(this.helpCounter==0)
			{	
				this.InformationLabel.setText("<html><font color=white> " + "Click Here for advanced <font color=red> HELP and INSTRUCTIONS </font>" + " </font></html>");
			}else
			{
				this.InformationLabel.setText("<html><font color=white> " + "Click Here to close the <font color=red> advanced HELP and INSTRUCTIONS </font>" + " </font></html>");
			}
		}else if(e.getSource()==this.chessHelp)
		{
			this.chessHelp.setIcon(new ImageIcon("Chess-info4.png"));
			this.InformationLabel.setText("<html><font color=white> " + "Click Here for <font color=red> GUIDE ON CHESS GAME </font>" + " </font></html>");

		}else if(e.getSource()==this.queenHelp)
		{
			this.queenHelp.setIcon(new ImageIcon("Eight-queen4-info.png"));
			this.InformationLabel.setText("<html><font color=white> " + "Click Here for <font color=red> GUIDE ON EIGHT QUEENS GAME </font>" + " </font></html>");

		}else if(e.getSource()==this.knightHelp)
		{
			this.knightHelp.setIcon(new ImageIcon("Knight-tour4-info.png"));
			this.InformationLabel.setText("<html><font color=white> " + "Click Here for <font color=red> GUIDE ON KNIGHT'S TOUR GAME </font>" + " </font></html>");

		}
	}



	@Override
	public void mouseExited(MouseEvent e) {
		if(e.getSource()==this.chess)
		{
			this.chess.setIcon(new ImageIcon("chess-button.png"));
			this.InformationLabel.setText("<html><font color=white> " + "Welcome to <font color=red> MAIN MENU </font>" + " </font></html>");
		}else if(e.getSource()==this.eightQueens)
		{
			this.eightQueens.setIcon(new ImageIcon("Eight-Queen-button.png"));
			this.InformationLabel.setText("<html><font color=white> " + "Welcome to <font color=red> MAIN MENU </font>" + " </font></html>");

		}else if(e.getSource()==this.knightsTour)
		{
			this.knightsTour.setIcon(new ImageIcon("knight-tour-button.png"));
			this.InformationLabel.setText("<html><font color=white> " + "Welcome to <font color=red> MAIN MENU </font>" + " </font></html>");

		}else if(e.getSource()==this.help)
		{
			this.help.setIcon(new ImageIcon("Help.png"));
			this.InformationLabel.setText("<html><font color=white> " + "Welcome to <font color=red> MAIN MENU </font>" + " </font></html>");

		}else if(e.getSource()==this.chessHelp)
		{
			this.chessHelp.setIcon(new ImageIcon("Chess-info.png"));
			this.InformationLabel.setText("<html><font color=white> " + "Welcome to <font color=red> MAIN MENU </font>" + " </font></html>");

		}else if(e.getSource()==this.queenHelp)
		{
			this.queenHelp.setIcon(new ImageIcon("Eight-queen-info.png"));
			this.InformationLabel.setText("<html><font color=white> " + "Welcome to <font color=red> MAIN MENU </font>" + " </font></html>");

		}else if(e.getSource()==this.knightHelp)
		{
			this.knightHelp.setIcon(new ImageIcon("Knight-tour-info.png"));
			this.InformationLabel.setText("<html><font color=white> " + "Welcome to <font color=red> MAIN MENU </font>" + " </font></html>");

		}
		
	}



	@Override
	public void mousePressed(MouseEvent e) 
	{
		// TODO Auto-generated method stub
		
	}



	@Override
	public void mouseReleased(MouseEvent e) 
	{
		// TODO Auto-generated method stub
		
	}
	
}
